<?php 
include("inc/smarty.php");
include("inc/common.inc.php");
include("menu.php");
date_default_timezone_set('Asia/Chongqing');//设置时区

$aid=$_GET['aid'];
isnum($aid,"对不起，没有找到该页面！",$web_info['website_root']);//过滤get变量不为数字的

$sql=select_sql("`isdel`","`".PRETABLE."arcmain`","`id`='".$aid."'");//查询对应文章

//过滤库中找不到的文章
$rs=$db->query($sql) or die("datebase error!");
if(!$rs->num_rows){
	ShowMsg_h("对不起，没有找到该页面！",$web_info['website_root']);
	exit;
}

//过滤标记为已删除的文章
$isdel=$rs->fetch_assoc();
if($isdel['isdel']){
	ShowMsg_h("对不起，没有找到该页面！",$web_info['website_root']);
	exit;
}

$articlemsg=array();
$sql="SELECT * FROM `".PRETABLE."arcmain` INNER JOIN `".PRETABLE."article` ON `".PRETABLE."arcmain`.`id`=`".PRETABLE."article`.`aid` WHERE `".PRETABLE."arcmain`.`id`='".$aid."'";
$rs=$db->query($sql) or die("datebase error!");
$articlemsg=$rs->fetch_assoc();

foreach($articlemsg as $k => $v){
	$smarty->assign("article_".$k,$v);
}


$sql=select_sql("`typename`","`".PRETABLE."arctype`","`id`='".$articlemsg['typeid']."'");//查询对应栏目
$rs=$db->query($sql) or die("datebase error!");
$typename=$rs->fetch_assoc();
$smarty->assign("typename",$typename['typename']);

$rs->close();
$db->close();
$smarty->display("article.htm");
?>